<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <base href="#{request.contextPath}/" />
        <title><h:outputText value="Update Profile" /></title>
        <link rel="stylesheet" type="text/css" href="css/perfil.css" />
    </h:head>
    <h:body>
        <p:panel id="title" >
            <p:graphicImage value="css/img/logo8.png" id="logo" alt="imagem titulo"/>
        </p:panel>
        <p:panel id="panelBody" >
            <p:panel id="panelContent" >
                <p:graphicImage value="css/img/ladoRegister.png" id="imglado"/>
            </p:panel>
            <p:panel id="panelProfile" >
                <h:form id="formRegister" prependId="false" >
                    <p:growl autoUpdate="true" life="5000" id="msgCad" />
                    <h:outputLabel value="Update your profile" styleClass="labelRegister"/>
                    <h:link value="Back to home" outcome="home2" id="linkHome"/>
                    <br /><br /> 
                    <h:outputLabel for="fname" value="First name" />
                    <br /><p:inputText id="fname" value="#{usuarioMB.us.nome}" required="true" requiredMessage="Field first name is required" />
                    <p:message for="fname" />
                    <h:outputLabel for="lname" value="Last name" />
                    <br /><p:inputText id="lname" value="#{usuarioMB.us.sobrenome}" required="true" requiredMessage="Field last name is required" />
                    <p:message for="lname" />
                    <h:outputLabel for="date" value="Date of birth" />
                    <br /><p:calendar id="date" value="#{usuarioMB.us.dataNasc}" effect="explode" effectDuration="500"/><br />
                    <h:outputLabel for="cidade" value="City" />
                    <br /><p:inputText id="cidade" value="#{usuarioMB.us.pais}"/><br />
                    <h:outputLabel for="estado" value="State" />
                    <br /><p:inputText id="estado" value="#{usuarioMB.us.estado}"/><br />
                    <h:outputLabel for="pais" value="Country" />
                    <br /><p:inputText id="pais" value="#{usuarioMB.us.pais}"/><br />



                    <p:commandLink onclick="changePassword.show();" value="Change password" id="linkChange"/>
                    <p:dialog widgetVar="changePassword" width="500" height="189" id="dialogPhoto" modal="true" header="Change your password" >
                        <h:form prependId="false">
                            <p:growl id="msgs" life="5000" />
                            <p:panelGrid columns="2" >
                                <h:outputLabel for="senhaOld" value="Digite a senha atual" />
                                <p:password value="#{usuarioMB.senhaOld}" id="senhaOld"/>
                                <h:outputLabel for="senhaNova" value="Digite a nova senha" />
                                <p:password id="senhaNova" value="#{usuarioMB.senhaNova}" match="confSenhaNova"
                                            validatorMessage="A senha nova e a confirmação da senha não são iguais"/>
                                <h:outputLabel for="confSenhaNova" value="Digite novamente a senha nova" />
                                <p:password id="confSenhaNova" />
                            </p:panelGrid>
                            <p:commandButton value="Salvar senha" action="#{usuarioMB.mudarSenha}" update="msgs" ajax="true" />
                        </h:form>
                    </p:dialog>



                    <!--                   -->
                    <br /><p:commandButton value="Update" action="#{usuarioMB.atualizar}" ajax="true" update="formRegister"/>
                </h:form>
            </p:panel>
        </p:panel>
    </h:body>
</html>